<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./lib/react.development.js"></script>
    <script src="./lib/react-dom.development.js"></script>
    <script src="./lib/babel.min.js"></script>
</head>
<body>
    <div id="root"></div>
    <script type="text/babel">
        // 创建一个React容器
    const root = ReactDOM.createRoot(document.querySelector("#root"));
    // class App extends React.Component{
    //     constructor(props){
    //         super(props)
    //         this.state={num:1}
    //     }
    //     render(){
    //         return(
    //             <div>
    //                 <button onClick={()=>{this.setState({num:this.state.num+1})}}>{this.state.num}</button>
    //             </div>
    //         )
    //     }
    // }
    // root.render(<App/>)

    class App extends React.Component {
        state={
            num:0
        }
        render() {
            return(
                <div>
                    <button onClick={()=>{this.setState({num:this.state.num+1})}}>{this.state.num}</button>
                </div>
            )
        }
    }
    root.render(<App/>)
    </script>
</body>
</html>